<!--conf
       <sample in_favorites="true">
              <product version="1.1" edition="std"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
--> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>TabBar events</title>
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxtabbar.css">
	
	<script  src="../../codebase/dhtmlxcommon.js"></script>
	<script  src="../../codebase/dhtmlxtabbar.js"></script>
</head>

<body>
<link rel='STYLESHEET' type='text/css' href='../common/style.css'>
<table cellspacing="0" cellpadding="0" class="sample_header" border="0">
	<tr valign="middle">
		<!-- COMPONENT ICON -->
		<td width="40" align="center"><img src="../common/dhtmlxtabbar_icon.gif" border="0"></td>
		<!-- COMPONENT NAME -->
		<td width="120" align="left">Sample: dhtmlxTabbar</td>
		<!-- SAMPLE TITLE -->
		<td width="0" align="left"><b>TabBar events</b></td>
		<!-- LINK TO COMPONENT PAGE -->
		<td width="0" align="right"><a href="http://www.dhtmlx.com/docs/products/dhtmlxTabbar/index.shtml">dhtmlxTabbar main page</a></td>
		<!-- CLOSE BUTTON -->
		<td width="50"><div class="sample_close"><a href="javascript:void(0);" onclick="self.close();"><img src="../common/sample_close.gif" width="14" height="14" border="0" alt="X"></a></div></td>
	</tr>
</table>
	
	
	<p>
		You can set event handler for tab selection. If it returns <em>false</em> then tab selection will not be changed.
	</p>
	
	<table>
		<tr>
			<td>
				<div id="a_tabbar" style="width:412; height:100;"/>
			</td>
	</table>
<br>
<div class='sample_code'><div class="hl-main"><pre><span class="hl-code"> 
</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span><span class="hl-code"><div class="hl-main"><pre><span class="hl-code"> 
            </span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">my_func</span><span class="hl-brackets">(</span><span class="hl-identifier">idn</span><span class="hl-code">,</span><span class="hl-identifier">ido</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-code">
                </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">confirm</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">Tab </span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">idn</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string"> to set active</span><span class="hl-special">\n</span><span class="hl-string">Please Confirm?</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-brackets">)</span><span class="hl-code">
                    </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">true</span><span class="hl-code">;
                </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-reserved">false</span><span class="hl-code">;
            </span><span class="hl-brackets">}</span><span class="hl-code">;
 
            </span><span class="hl-identifier">tabbar</span><span class="hl-code">=</span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">dhtmlXTabBar</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">a_tabbar</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">top</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
               ...            
            </span><span class="hl-identifier">tabbar</span><span class="hl-code">.</span><span class="hl-identifier">setOnSelectHandler</span><span class="hl-brackets">(</span><span class="hl-identifier">my_func</span><span class="hl-brackets">)</span><span class="hl-code">;
            </span><span class="hl-identifier">tabbar</span><span class="hl-code">.</span><span class="hl-identifier">loadXML</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">tabs1.xml</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></pre></div></span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span></pre></div></div>
	<script>

            function my_func(idn,ido){
                if (confirm("Tab "+idn+" to set active\nPlease Confirm?"))
                    return true;
                return false;
            };
			tabbar=new dhtmlXTabBar("a_tabbar","top");
            tabbar.setImagePath("../../codebase/imgs/");
            tabbar.setOnSelectHandler(my_func);
            
            tabbar.loadXML("tabs1.xml");

	</script>

<!-- FOOTER -->
<table callspacing="0" cellpadding="0" border="0" class="sample_footer"><tr><td style="padding-left: 8px;">&copy; <a href="http://www.dhtmlx.com">DHTMLX LTD</a>. All rights reserved</td></tr></table>
<!-- FOOTER -->

</body>
</html>
